<script>
import { mapActions } from "vuex";
export default {
  methods: {
    ...mapActions({
      login: "user/login",
    }),
  },
  onLaunch: function () {
    console.log("wx.login...", wx.login);
    wx.login({
      success: async (res) => {
        if (res.code) {
          //发起网络请求
          await this.login(res.code);
        } else {
          console.log("登录失败！" + res.errMsg);
        }
      },
    });
  },
  onShow: function () {
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
  },
};
</script>

<style>
/*每个页面公共css */
</style>